package com.yunxi.service.dubboService.impl.customer;

import com.github.pagehelper.PageInfo;
import com.yunxi.customer.pojo.CustomerLinkVO;
import com.yunxi.customer.service.CustomerLinkDubboService;
import com.yunxi.model.customer.CustomerLink;
import com.yunxi.service.localService.customer.CustomerLinkService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.lang.reflect.InvocationTargetException;

/**
 * <p>
 * 客户联系人 服务实现类
 * </p>
 *
 * @author 
 * @since 2019-05-14
 */
public class CustomerLinkDubboServiceImpl implements CustomerLinkDubboService {

    @Autowired
    @Qualifier(value = "customerLinkServiceImpl")
    CustomerLinkService customerLinkService;


    @Override
    public CustomerLinkVO getById(String id) throws InvocationTargetException, IllegalAccessException {
    CustomerLink customerLink = customerLinkService.getById(id);
    CustomerLinkVO customerLinkVO = new CustomerLinkVO();
        BeanUtils.copyProperties(customerLink,customerLinkVO);
        return customerLinkVO;
    }

    @Override
    public void saveOrUpdate(CustomerLinkVO customerLinkVO) throws InvocationTargetException, IllegalAccessException {
    CustomerLink customerLink = new CustomerLink();
        BeanUtils.copyProperties(customerLinkVO,customerLink);
    customerLinkService.saveOrUpdate(customerLink);
    }

    @Override
    public void removeById(String id) {
    customerLinkService.removeById(id);
    }

    @Override
    public PageInfo<CustomerLinkVO> findPageByVO(CustomerLinkVO customerLinkVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {

      PageInfo<CustomerLinkVO> pageInfo = customerLinkService.pageByVo(customerLinkVO,pageNum,pageSize);

      return pageInfo;

   }

}
